
using UniversalAdmin.Domain.Entities;
using MediatR;
using UniversalAdmin.Domain.DomainEvents;
namespace UniversalAdmin.Domain.Entities.App;

public class AppMenu : EntityBase
{
    public string MenuName { get; set; } = null!; // 菜单名称
    public string Path { get; set; } = null!; // 路由路径
    public string? Icon { get; set; } // 图标名称 (可空)
    public Guid? ParentId { get; set; }
    public int SortOrder { get; set; }
    public ICollection<AppRole> Roles { get; set; } = new List<AppRole>();

    // 领域事件发布
    public void OnCreated() => AddDomainEvent(new MenuCreatedEvent(this));
    public void OnUpdated() => AddDomainEvent(new MenuUpdatedEvent(this));
    public void OnDeleted() => AddDomainEvent(new MenuDeletedEvent(this));
}